<template>
	<view>
		<view class="topBox">
			<image src="../../static/home/jiangbei.png"></image>
			<view>本次答题<text>{{details.score}}</text>分</view>
		</view>
		<view class="text t-c">{{details.expiry || ''}}</view>
		<view class="btnBox" v-if="pagetype==='党建学习'" @click="onSkip()">
			<view class="btn btnBox">重新答题</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '', //试题id
				details: {},
				pagetype: '',
				joinPaperId: '', //结果id
			}
		},
		onLoad(opt) {
			this.id = opt.id
			this.joinPaperId = opt.joinPaperId
			this.pagetype = opt.pagetype
		},
		onShow() {
			this.getResult();
		},
		methods: {
			onSkip() {
				this.$to(`/pages/index/test/test?id=${this.id}&pagetype=${this.pagetype}结果`)
			},
			async getResult() {
				const res = await this.$api.get(`paper/psychology/conclusion/${this.joinPaperId}`, {});
				console.log(res, "11111--")
				if (res.code == 200) {
					this.details = res.data
				}

			},
		}
	}
</script>

<style lang="scss" scoped>
	.btnBox {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.btn {
		width: 400rpx;
		height: 67rpx;
		background: #2E80FE;
		border-radius: 13rpx;
		font-size: 29rpx;
		font-weight: bold;
		color: #FFFFFF;
		line-height: 32rpx;

	}

	.text {
		font-size: 24rpx;
		color: #666;
		line-height: 42rpx;
		padding: 30rpx;
	}

	.topBox {
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
		color: #666;

		text {
			font-size: 53rpx;
			color: #EB1919;
			font-weight: bold;
			margin: 20rpx;
			font-style: oblique;
		}
	}

	image {
		width: 40vw;
		height: 300rpx;
	}
</style>